package com.bilibili.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.bilibili.entity.CommenResult;
import com.bilibili.entity.Video;
import com.bilibili.service.VideoService;
import com.bilibili.service.impl.VideoServiceImpl;

@WebServlet("/allVideo.do")
public class AllVideoServlet extends HttpServlet {
    VideoService vs = new VideoServiceImpl();

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("application/json;charset=utf-8");
        List<Video> list = vs.selectByAll(1); // 修正方法名大小写
        CommenResult result = new CommenResult();
        result.setData(list);
        response.getWriter().write(result.toJOSNString());
    }
}